<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //var a = 1;
        /* a++; */
        /* ++a;
        console.log(a);


        var b = 1;
        console.log(b++);
        console.log(b) */

      var num = prompt ("请输入班级总人数");
      var sum = 0;
      var a = 0;//求平均值
      for(var i = 1 ; i <= num ; i++ ) {
         var score = prompt("请输入第"+ i +"个学生成绩")
         sum = sum + parseFloat(score);
      }
      alert ("班级总成绩是" + sum);
      a = sum / num;
      alert ("班级平均分是" + a);
    </script>
</body>
</html>